<template>
	<div class="mask animate__animated animate__fadeIn" v-if="show">
		<div class="box">
			<div class="item">
				<span>游戏背景音乐</span>
				<van-checkbox v-model="checked_Bg" shape="square" checked-color="#f1b6b4"></van-checkbox>
			</div>
			<div class="btn" @click="emits('update:show', false)">关闭</div>
		</div>
	</div>
</template>
<script setup>
import { ref, onMounted, watch, nextTick } from "vue";
const checked_Bg = ref(window.bgStatus ? true : false);
watch(checked_Bg, (newValue, oldValue) => {
	window.bgStatus = newValue;
	if (newValue === false) {
		document.getElementById("bgMusic").pause();
	} else {
		document.getElementById("bgMusic").play();
	}
});
const emits = defineEmits(["update:show"]);
defineProps({
	show: {
		type: Boolean,
		default: false,
	},
});
</script>
<style scoped>
.mask {
	background: rgb(255 255 255 / 30%);
	position: fixed;
	z-index: 99;
	width: 100vw;
	height: 100vh;
	top: 0;
}
.box {
	background-color: black;
	border-radius: 2vw;
	box-sizing: border-box;
	padding: 3vw;
	width: 60%;
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}
.msg {
	color: white;
	text-align: center;
	font-size: 4vw;
	margin-bottom: 5vw;
}
.btn {
	padding: 0.8vw 5vw;
	border: 2px solid #f1b6b4;
	border-radius: 2px;
	color: transparent;
	-webkit-text-fill-color: #ffffff;
	-webkit-text-stroke: 1px #f1b6b4;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 1.5rem;
	box-shadow: 3px 2px 4px 0px #f1b6b4b8;
	user-select: none;
	width: 50%;
	margin: 0 auto;
	margin-top: 5vw;
}
.item {
	color: white;
	font-size: 4vw;
	margin: 2vw 0;
	text-align: center;
	display: flex;
	justify-content: space-evenly;
}
</style>
